<?php
 require_once('inc/Database.inc');
 $link = ConnectToDatabase2();
 
	 if( $_POST['notFirstTime'] != 'True')
	 {
	 	$date = date("Y-m-d\ H:i:s");
	 	$title = "";
	 	$news = "";
	 }
	 else
	 {
	 	$date = mysql_real_escape_string ($_POST['date'], $link);
	 	$title= mysql_real_escape_string ($_POST['title'], $link);
	 	$news = mysql_real_escape_string ($_POST['news'], $link);
	 	
	 	$sql = "INSERT INTO news VALUES('$date','$news','$title');";
	 	RunSql($sql,$link);
	 	echo "Inserted Sucessfully!";
	 }
?>

<HTML>
	<head>
	 	<TITLE>Cure</TITLE>
	</head>
	
	<BODY>
		<form method="post" >
			<input type="hidden" name="notFirstTime" value="True" />
			<input type="hidden" name="date" value="<?php echo $date ?>"/>
			
			<table>
				<tr>
					<td>Title </td> 
					<td>
						<input type="text" size="50" name="title" value="<?php echo $title?>"/>
					</td>
				</tr>
				<tr>
					<td valign="top">News </td>
					<td>
						<textarea rows="10" cols="50" name="news"><?php echo $news?></textarea>
					</td>
				</tr>
				<tr>
					<td colspan="2" align="right">
						<input type="Submit" value="Submit" />
					</td>
				</tr>
			</table>
		</form>
	</BODY>
</HTML>